library Cauterize initializer init 

	private function Trig_Cauterize_CauterizeConditions takes nothing returns boolean
		return GetSpellAbilityId()=='A01R'
	endfunction

	private function Trig_Cauterize_Cauterize takes nothing returns nothing
		local integer i = 1
		local unit u = GetSpellTargetUnit()
		local real life = GetWidgetLife(u)-15.0
		loop
			exitwhen i > 3
			call UnitRemoveAbility(u,'B00A')
			call UnitRemoveAbility(u,'A01G')
			set i = i + 1
		endloop
		if life<0.0 then
			set life=0.0
		endif
		call SetWidgetLife(u,life)
		set u = null
	endfunction

	private function init takes nothing returns nothing
		local trigger t
		set t = CreateTrigger(  )
		call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT  )
		call TriggerAddCondition( t, Condition( function Trig_Cauterize_CauterizeConditions ) )
		call TriggerAddAction( t, function Trig_Cauterize_Cauterize )
	endfunction
	
endlibrary